package cn.dsttl3.tupan.utils.baidu;

import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;

import java.io.IOException;

public class BaiduQuota {
    /**
     * 获取网盘容量信息
     * @param token token
     */
    public String get(String token){
        String url = "https://pan.baidu.com/api/quota?access_token="+token;
        try {
            OkHttpClient client = new OkHttpClient();
            Request request = new Request.Builder().url(url)
                    .header("User-Agent","pan.baidu.com")
                    .build();
            Call call = client.newCall(request);
            return call.execute().body().string();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
